import pymysql

client = pymysql.connect(
    host='localhost',
    user='root',
    passwd='123456',
    port=3306,
    db='hugo',
    charset='utf8'
)
cursor = client.cursor()
# sql = '''
#     create table user(
#         id int,
#         name varchar(20),
#         password varchar(20)
#         )
# '''
# sql = '''
#     insert into user values
#         (1,'wyh','123'),
#         (2,'yc','123'),
#         (3,'whs','123')
#     '''
username = input('请输入用户名：').strip()
password = input('请输入密码：').strip()
# sql = 'select name from user where name = "%s" and password = "%s"'%(username,password)
sql = 'select name from user where name = %s and password = %s'
print(sql)
res = cursor.execute(sql,(username,password))
'''
sql = 'select name from user where name = &s and password = %s'
cursor.execute(sql,(username,password))
sql = 'select name from user where name = %s and password = %s'
cursor.execute(sql,(username,password))
sql = 'select name from user where name = %s anmd passowrd = %s;'
cursor.execute(sql (username,password))
sql = 'delect name from user where name = %s and password = %s;'
cursor.execute(sql,(username,password))
sql = 'select name from user where name = %s and password = %s'
cursor.execute(sql,(username,password))
sql = 'select name from user where name = %s and pasword = %s'
cursor.execute(sql,(username,password))
sql = 'select name from user where name = %s and password = %s'
cursor.execute(sql,(username,password))
sql = 'select name from user where name = %s and password = %s'
cursor.execute(sql,(username,password))
sql ='select name from user where name = %s and password %s'
cursor.execute(sql,(username,password))
sql = 'select name from user where name = %s and password = %s'
cursor.execute(sql,(usaername,password))
sql = 'select name from user where name = %s and password = %s'
cursor.execute(sql,(username,password))


'''
print(res)
# print(res)
if res:
    print('登陆成功')
else:
    print('登陆失败')
client.commit()
cursor.close()
client.close()

